package com.atguigu.c_stream_strat;

import java.util.*;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class Demo {
    public static void main(String[] args) {
        //单列集合
        ArrayList<Integer> list = new ArrayList<>();
        HashSet<String> set = new HashSet<>();

        Stream<Integer> stream1 = list.stream();
        Stream<String> stream2 = set.stream();

        System.out.println("stream1 = " + stream1);
        System.out.println("stream2 = " + stream2);
        //双列集合
        HashMap<String, Integer> hm = new HashMap<>();
        //先把双列变单列
        Set<Map.Entry<String, Integer>> entries = hm.entrySet();
        Stream<Map.Entry<String, Integer>> stream3 = entries.stream();
        System.out.println("stream3 = " + stream3);

        System.out.println("-----------------------------");
        //数组进流
        String[] names = {"张三","李四","王五"};
        Stream<String> stream4 = Arrays.stream(names);

        int[] arr = new int[5];
        IntStream stream5 = Arrays.stream(arr);
        System.out.println("stream4 = " + stream4);
        System.out.println("stream5 = " + stream5);
        System.out.println("-----------------------------");
        //一组同类型的数据
        Stream<Integer> stream6 = Stream.of(1, 2, 3, 4, 5);
        Stream<String> stream7 = Stream.of("张三","李四","王五");
        System.out.println("stream6 = " + stream6);
        System.out.println("stream7 = " + stream7);
    }
}
